﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Card.Manager
{
    public partial class LogoPicker : BasePage
    {
        #region
        private string LogoType
        {
            get
            {
                return Request.QueryString["t"];
            }
        }

        public string FaceType
        {
            get
            {
                return Request.QueryString["ft"];
            }
        }
        #endregion

        #region
        protected void Page_Load(object sender, EventArgs e)
        {
            this.DoInit();
        }

        protected override void OnInit(EventArgs e)
        {
            this.pager.BuildingUrl += new BAF.WebControls.BuildingUrlHander(pager_BuildingUrl);
            base.OnInit(e);
        }

        string pager_BuildingUrl(int index)
        {
            return string.Format("LogoPicker.aspx?ft={0}&t={1}&i={2}", this.FaceType,LogoType, index);
        }
        #endregion

        #region
        private void DoInit()
        {
            Card.DataBase.Pagination pagination = new Card.DataBase.Pagination()
            {
                TableName = "LOGO",
                PageSize = this.pager.PageSize,
                OrderBy = "CREATE_DATE DESC,ID",
                PageNumber = this.pager.PageIndex + 1,
                Condition = string.IsNullOrEmpty(this.LogoType) ? string.Empty : string.Format(" TYPE_CODE='{0}'", this.LogoType)
            };

            DataTable dtData = BLL.TemplateManager.Query(pagination);
            this.pager.RecordCount = pagination.RecordCount;
            this.rptList.DataSource = dtData;
            this.rptList.DataBind();
        }
        #endregion
    }
}
